﻿using System;
using System.Html.DOM;

namespace jQueryLib
{
    /// <summary>
    /// The class will translate to jQuery, when use noConflict() mode, should use this class later.
    /// </summary>
    [ImportClass(string.Empty, "jQuery")]
    public partial class JQuery
    {
        /// <summary>
        /// Alias of prototype.
        /// </summary>
        public static object Fn;

        /// <summary>
        /// Holds or releases the execution of jQuery's ready event.
        /// </summary>
        /// <param name="hold"></param>
        public static void HoldReady(bool hold)
        {
        }

        /// <summary>
        /// Free the '$' name
        /// </summary>
        public static void NoConflict()
        {
        }

        /// <summary>
        /// With true passed in, even 'jQuery' name is free, not recommended.
        /// </summary>        
        public static void NoConflict(bool removeAll)
        {
        }

        //TODO:
        public static object CssHooks;

        /// <summary>
        /// A multi-purpose callbacks list object that provides a powerful way to manage callback lists.
        /// </summary>
        /// <returns></returns>
        [ImportMember("Callbacks")]
        public static Callbacks Callbacks()
        {
            return null;
        }

        /// <summary>
        /// A multi-purpose callbacks list object that provides a powerful way to manage callback lists.
        /// </summary>
        /// <param name="flag">Define in Callbacks constant, space-separated flags</param>
        /// <returns></returns>
        [ImportMember("Callbacks")]
        public static Callbacks Callbacks(string flag)
        {
            return null;
        }

        public static Deferred Deferred()
        {
            return null;
        }

        [ImportMember("Event")]
        public static JQueryEvent Event(string name)
        {
            return null;
        }

        [ImportMember("Event")]
        public static JQueryEvent Event(string name, object map)
        {
            return null;
        }

        /// <summary>
        /// Provides a way to execute callback functions based on one object, usually Deferred objects that represent asynchronous events.
        /// </summary>
        /// <param name="deferred"></param>
        /// <returns></returns>
        public static Promise When(Deferred deferred)
        {
            return null;
        }

        /// <summary>
        /// Provides a way to execute callback functions based on many objects, usually Deferred objects that represent asynchronous events.
        /// </summary>
        /// <param name="deferred"></param>
        /// <returns></returns>
        public static Promise When(params Deferred[] deferred)
        {
            return null;
        }

        /// <summary>
        /// Store arbitrary data associated with the specified element. Returns the value that was set.
        /// </summary>
        /// <param name="elem"></param>
        /// <param name="key"></param>
        /// <param name="val"></param>
        public static object Data(HtmlElement elem, string key, object val)
        {
            return null;
        }

        /// <summary>
        /// Returns value at named data store for the element, as set by jQuery.data(element, name, value),
        /// </summary>
        /// <param name="elem"></param>
        /// <param name="key"></param>
        public static object Data(HtmlElement elem, string key)
        {
            return null;
        }

        /// <summary>
        /// Returns the full data store for the element.
        /// </summary>
        /// <param name="elem"></param>
        public static object Data(HtmlElement elem)
        {
            return null;
        }

        /// <summary>
        /// Determine whether an element has any jQuery data associated with it.
        /// </summary>
        /// <returns></returns>
        public static bool HasData(HtmlElement elem)
        {
            return false;
        }

        /// <summary>
        /// Remove a previously-stored piece of data.
        /// </summary>
        /// <param name="elem"></param>
        /// <param name="key"></param>
        public static void RemoveData(HtmlElement elem, string key)
        {
        }

        /// <summary>
        /// Remove a previously-stored piece of data.
        /// </summary>
        /// <param name="elem"></param>
        /// <param name="key"></param>
        public static void RemoveData(HtmlElement elem)
        {
        }

        /// <summary>
        /// Show the queue of functions to be executed on the matched element.
        /// Queue defaults to fx, the standard effects queue.
        /// </summary>
        /// <param name="elem"></param>
        /// <returns></returns>
        public static object[] Queue(HtmlElement elem)
        {
            return null;
        }

        /// <summary>
        /// Show the queue of functions to be executed on the matched element.
        /// </summary>
        /// <param name="jQueryInstance"></param>
        /// <param name="queueName">A string containing the name of the queue.</param>
        /// <returns></returns>
        public static object[] Queue(HtmlElement elem, string queueName)
        {
            return null;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="elem">A DOM element where the array of queued functions is attached.</param>
        /// <param name="queueName">A string containing the name of the queue. Defaults to fx, the standard effects queue.</param>
        /// <param name="newQueue">An array of functions to replace the current queue contents.</param>
        public static object[] Queue(HtmlElement elem, string queueName, Delegate[] newQueue)
        {
            return null;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="elem">A DOM element where the array of queued functions is attached.</param>
        /// <param name="queueName">A string containing the name of the queue. Defaults to fx, the standard effects queue.</param>
        /// <param name="callback">The new function to add to the queue.</param>
        public static object[] Queue(HtmlElement elem, string queueName, Action callback)
        {
            return null;
        }

        /// <summary>
        /// Execute the next function on the queue for the matched element.
        /// </summary>
        /// <param name="elem"></param>
        public static void Dequeue(HtmlElement elem)
        {
        }

        /// <summary>
        /// Execute the next function on the queue for the matched element.
        /// </summary>
        /// <param name="elem"></param>
        /// <param name="queueName">A string containing the name of the queue. Defaults to fx, the standard effects queue.</param>
        public static void Dequeue(HtmlElement elem, string queueName)
        {
        }

        /// <summary>
        /// Takes a string and throws an exception containing it.
        /// </summary>
        /// <param name="msg"></param>
        public static void Error(string msg)
        {
        }

        /// <summary>
        /// Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request.
        /// </summary>
        /// <param name="param">An array or object to serialize.</param>
        /// <returns></returns>
        public static string Param(object param)
        {
            return null;
        }

        /// <summary>
        /// Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request.
        /// </summary>
        /// <param name="param">An array or object to serialize.</param>
        /// <param name="traditional">A Boolean indicating whether to perform a traditional "shallow" serialization.</param>
        /// <returns></returns>
        public static string Param(object param, bool traditional)
        {
            return null;
        }
    }

    /// <summary>
    /// This class is used for hold the global selector function $() or jQuery()
    /// </summary>
    [ImportClass(string.Empty, string.Empty)]
    public static partial class Selector
    {
        /// <summary>
        /// use when in noConflict mode
        /// </summary>
        /// <returns></returns>
        public static JQueryInstance JQuery()
        {
            return null;
        }

        /// <summary>
        /// use when in noConflict mode
        /// </summary>
        /// <param name="selector"></param>
        /// <returns></returns>
        public static JQueryInstance JQuery(string selector)
        {
            return null;
        }

        /// <summary>
        /// use when in noConflict mode
        /// </summary>
        /// <param name="selector"></param>
        /// <param name="context">it should be jQuery object or DomElement. 
        /// use 'this' keyword with caution -- it mean different in C# and javascript</param>
        /// <returns></returns>
        public static JQueryInstance JQuery(string selector, object context)
        {
            return null;
        }

        /// <summary>
        /// use when in noConflict mode
        /// </summary>
        /// <param name="target">should be DomElement, jQuery object or plain object
        /// use 'this' keyword with caution -- it mean different in C# and javascript</param>
        /// <returns></returns>
        public static JQueryInstance JQuery(object target)
        {
            return null;
        }
    }

    /// <summary>
    /// This class is used for hold the global function $() or jQuery() to create DOM
    /// </summary>
    [ImportClass(string.Empty, string.Empty)]
    public static partial class Creator
    {
        /// <summary>
        /// The global function jQuery() create DOM
        /// </summary>
        /// <param name="selector"></param>
        /// <returns></returns>
        public static JQueryInstance JQuery(string htmlSnippet)
        {
            return null;
        }

        /// <summary>
        /// The global function jQuery() create DOM
        /// </summary>
        /// <param name="selector"></param>
        /// <param name="properties">the attributes which will assign to the element</param>
        /// <returns></returns>
        public static JQueryInstance JQuery(string htmlSnippet, object properties)
        {
            return null;
        }
    }
}